auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public OutputStream decorateLogger(AbstractBuild build, final OutputStream logger) { final AnsiColorMap colorMap = getDescriptor().getColorMap(getColorMapName()); if (logger != null) return new LineTransformationOutputStream() { AnsiHtmlOutputStream ansi = new AnsiHtmlOutputStream(logger, colorMap, defaultFg, defaultBg, new AnsiAttributeElement.Emitter() { public void emitHtml(String html) { try { new SimpleHtmlNote(html).encodeTo(logger); } catch (IOException e) { LOG.log(Level.WARNING, "Failed to add HTML markup '" + html + "'", e); } } }); @Override protected void eol(byte[] b, int len) throws IOException { ansi.write(b, 0, len); ansi.flush(); logger.flush(); } @Override public void close() throws IOException { ansi.close(); logger.close(); super.close(); } }; else return null; }

Target:
public OutputStream decorateLogger(AbstractBuild build, final OutputStream logger) { final AnsiColorMap colorMap = getDescriptor().getColorMap(getColorMapName()); if (logger == null) { return null; } return new LineTransformationOutputStream() { AnsiHtmlOutputStream ansi = new AnsiHtmlOutputStream(logger, colorMap, new AnsiAttributeElement.Emitter() { public void emitHtml(String html) { try { new SimpleHtmlNote(html).encodeTo(logger); } catch (IOException e) { LOG.log(Level.WARNING, "Failed to add HTML markup '" + html + "'", e); } } }); @Override protected void eol(byte[] b, int len) throws IOException { ansi.write(b, 0, len); ansi.flush(); logger.flush(); } @Override public void close() throws IOException { ansi.close(); logger.close(); super.close(); } }; }
Source:
public void testGetLocation() { CtfLocationInfo location = fixture.getLocationInfo(); long result = location.getTimestamp(); assertEquals(1337L, result); }

Target:
public void testGetLocation() { fixture = new CtfLocation(new CtfLocationInfo(1, 0)); CtfLocationInfo location = fixture.getLocationInfo(); long result = location.getTimestamp(); assertEquals(1L, result); }
Source:
public RowType returnType() { assert info.returnType() instanceof RowType : "table functions must have the row return type"; return (RowType) info.returnType(); }

Target:
public RowType returnType() { return RowType.EMPTY; }
Source:
public void before() { SetTraceTypePreferences(CHECK_ALL, ""); }

Target:
public void before() { setTraceTypePreferences(CHECK_ALL); }
Source:
NameChoosingHistoryManager(ListInfo listInfo, Context context) { this.listInfo = listInfo; dialog = new MaterialDialog.Builder(context) .title(R.string.chosen_names_history) .positiveText(android.R.string.yes) .neutralText(R.string.clear) .negativeText(R.string.copy_text) .onNeutral((dialog, which) -> { listInfo.clearNameHistory(); UIUtils.showShortToast(R.string.name_history_cleared, dialog.getContext()); }) .onNegative((dialog, which) -> NameUtils.copyNamesToClipboard( listInfo.getNameHistoryFormatted(), null, 0, true, dialog.getContext())) .build(); }

Target:
NameChoosingHistoryManager(ListInfo listInfo, Context context) { this.listInfo = listInfo; dialog = new MaterialDialog.Builder(context) .title(R.string.chosen_names_history) .positiveText(R.string.okay) .neutralText(R.string.clear) .negativeText(R.string.copy_text) .onNeutral((dialog, which) -> { listInfo.clearNameHistory(); UIUtils.showShortToast(R.string.name_history_cleared, dialog.getContext()); }) .onNegative((dialog, which) -> NameUtils.copyNamesToClipboard( listInfo.getNameHistoryFormatted(), null, 0, true, dialog.getContext())) .build(); }
Source:
public void testCsvMetacardTransformer() throws CatalogTransformerException { BinaryContent binaryContent = transformer.transform(normalMC, arguments); assertThat(binaryContent.getMimeType().toString(), is("text/csv")); }

Target:
public void testCsvMetacardTransformer() throws CatalogTransformerException, IOException { BinaryContent binaryContent = transformer.transform(normalMC, arguments); assertThat(binaryContent.getMimeType().toString(), is("text/csv")); List<String> attributes = Arrays.asList(new String(binaryContent.getByteArray()).split("\r\n")); List<String> attNames = Arrays.asList(attributes.get(0).split(",")); List<String> attValues = Arrays.asList(attributes.get(1).split(",")); for (int i = 0; i < attNames.size(); i++) { String attributeValue = attValues.get(i); assertThat(VALUES.contains(attributeValue), is(true)); } }
Source:
public void testComposedFunction() { ApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(FunctionsConfiguration.class)).web( WebApplicationType.NONE) .run("--spring.cloud.stream.function.definition=toUpperCase|concatWithSelf", "--spring.jmx" + ".enabled=false", "--logging.level.org.springframework.integration=DEBUG"); InputDestination source = context.getBean(InputDestination.class); OutputDestination target = context.getBean(OutputDestination.class); source.send(new GenericMessage<byte[]>("hello".getBytes(StandardCharsets.UTF_8))); byte[] result = target.receive(1000).getPayload(); System.out.println(new String(result)); assertThat(result).isEqualTo("HELLO:HELLO".getBytes(StandardCharsets.UTF_8)); }

Target:
public void testComposedFunction() { context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(FunctionsConfiguration.class)).web( WebApplicationType.NONE) .run("--spring.cloud.stream.function.definition=toUpperCase|concatWithSelf", "--spring.jmx" + ".enabled=false", "--logging.level.org.springframework.integration=DEBUG"); InputDestination source = context.getBean(InputDestination.class); OutputDestination target = context.getBean(OutputDestination.class); source.send(new GenericMessage<byte[]>("hello".getBytes(StandardCharsets.UTF_8))); assertThat(target.receive(1000).getPayload()).isEqualTo("HELLO:HELLO".getBytes(StandardCharsets.UTF_8)); }
Source:
public HttpMethodInfo handle(HttpRequest request, HttpResponder responder, Map<String, String> groupValues) throws Exception { try { if (httpMethods.contains(request.getMethod())) { Object args = new Object[paramsInfo.size()]; int idx = 0; for (Map<Class<? extends Annotation>, ParameterInfo<?>> info : paramsInfo) { if (info.containsKey(PathParam.class)) { args[idx] = getPathParamValue(info, groupValues); } if (info.containsKey(QueryParam.class)) { args[idx] = getQueryParamValue(info, request.getUri()); } if (info.containsKey(HeaderParam.class)) { args[idx] = getHeaderParamValue(info, request); } idx++; } return new HttpMethodInfo(method, handler, request, responder, args); } else { throw new HandlerException(HttpResponseStatus.METHOD_NOT_ALLOWED, String.format ("Problem accessing: %s. Reason: Method Not Allowed", request.getUri())); } } catch (Throwable e) { throw new HandlerException(HttpResponseStatus.INTERNAL_SERVER_ERROR, "Error in executing path", e); } }

Target:
public HttpMethodInfo handle(HttpRequest request, HttpResponder responder, Map<String, String> groupValues) throws Exception { try { if (httpMethods.contains(request.getMethod())) { Object args = new Object[paramsInfo.size()]; int idx = 0; for (Map<Class<? extends Annotation>, ParameterInfo<?>> info : paramsInfo) { if (info.containsKey(PathParam.class)) { args[idx] = getPathParamValue(info, groupValues); } if (info.containsKey(QueryParam.class)) { args[idx] = getQueryParamValue(info, request.getUri()); } if (info.containsKey(HeaderParam.class)) { args[idx] = getHeaderParamValue(info, request); } idx++; } return new HttpMethodInfo(method, handler, request, responder, args); } else { throw new HandlerException(HttpResponseStatus.METHOD_NOT_ALLOWED, String.format ("Problem accessing: %s. Reason: Method Not Allowed", request.getUri())); } } catch (Throwable e) { throw new HandlerException(HttpResponseStatus.INTERNAL_SERVER_ERROR, String.format("Error in executing request: %s %s", request.getMethod(), request.getUri()), e); } }
Source:
public void addSubmoduleWithInvalidPath() throws Exception { SubmoduleAddCommand command = new SubmoduleAddCommand(db); command.setPath("-invalid-path"); command.setURI("<LINK_0>"); try { command.call().close(); fail("Exception not thrown"); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), "Invalid submodule path '-invalid-path'"); } }

Target:
public void addSubmoduleWithInvalidPath() throws Exception { SubmoduleAddCommand command = new SubmoduleAddCommand(db); command.setPath("-invalid-path"); command.setURI("<LINK_0>"); try { command.call().close(); fail("Exception not thrown"); } catch (IllegalArgumentException e) { assertEquals("Invalid submodule name '-invalid-path'", e.getMessage()); } }
Source:
public String createConstantVariable(boolean negative, XNumberLiteral numberLiteral) { NumberLiterals literals = new NumberLiterals(); Number value = literals.numberValue(numberLiteral, literals.getJavaType(numberLiteral)); final Class<? extends Number> numberType = value.getClass(); if (negative) { if (numberType == Integer.TYPE || numberType == Integer.class) { value = value.intValue() * -1; } else if (numberType == Double.TYPE || numberType == Double.class) { value = value.doubleValue() * -1; } else if (numberType == Long.TYPE || numberType == Long.class) { value = value.longValue() * -1; } else if (numberType == Float.TYPE || numberType == Float.class) value = value.floatValue() * -1; else if (numberType == BigInteger.class) ((BigInteger)value).negate(); else if (numberType == BigDecimal.class) ((BigDecimal)value).negate(); else throw new IllegalArgumentException("Cannot convert number literal to type" + numberType.getCanonicalName()); } return createConstantVariable(value); }

Target:
public String createConstantVariable(boolean negative, XNumberLiteral numberLiteral) { NumberLiterals literals = new NumberLiterals(); Number value = literals.numberValue(numberLiteral, literals.getJavaType(numberLiteral)); final Class<? extends Number> numberType = value.getClass(); if (negative) { if (numberType == Integer.TYPE || numberType == Integer.class) { value = -value.intValue(); } else if (numberType == Double.TYPE || numberType == Double.class) { value = -value.doubleValue(); } else if (numberType == Long.TYPE || numberType == Long.class) { value = -value.longValue(); } else if (numberType == Float.TYPE || numberType == Float.class) value = -value.floatValue(); else if (numberType == BigInteger.class) ((BigInteger)value).negate(); else if (numberType == BigDecimal.class) ((BigDecimal)value).negate(); else throw new IllegalArgumentException("Cannot convert number literal to type" + numberType.getCanonicalName()); } return createConstantVariable(value); }
Source:
private static Value listGet(Value first, Value second) { if (!second.type.canBeLong()) { throw new IllegalArgumentException("Invalid index argument " + second + ", natural number expected"); } if (ValueType.LIST == first.type) { List<Value> list = first.getList(); if (list.size() <= second.getLong()) { throw new IllegalArgumentException("Out of bounds index value " + second.getLong() + ", list size " + list.size()); } return new Value(list.get((int) second.getLong()).toString()); } else { if (second.getLong() != 0) { throw new IllegalArgumentException("Out of bounds index value " + second.getLong() + ", list size " + 1); } return new Value(first.objectValue.toString()); } }

Target:
private static Value listGet(Value first, Value second) { if (!second.type.canBeLong()) { throw new IllegalArgumentException("Invalid index argument " + second + ", natural number expected"); } List<Value> valueList = ValueType.LIST == first.type ? first.getList() : convertToList(first.objectValue); if (valueList.size() > 1) { if (valueList.size() <= second.getLong()) { throw new IllegalArgumentException("Out of bounds index value " + second.getLong() + ", list size " + valueList.size()); } return new Value(valueList.get((int) second.getLong()).toString()); } else { if (second.getLong() != 0) { throw new IllegalArgumentException("Out of bounds index value " + second.getLong() + ", list size " + 1); } return new Value(first.objectValue.toString()); } }
Source:
private static String urlFromImagefapDirectoryName(String dir) { if (!dir.startsWith("imagefap")) return null; String url; String directory = dir.substring("imagefap_".length()); if (NumberUtils.isDigits(directory)) url = "<LINK_0>" + directory; else url = "<LINK_1>" + directory; return url; }

Target:
private static String urlFromImagefapDirectoryName(String dir) { if (!dir.startsWith("imagefap")) { return null; } String url; String directory = dir.substring("imagefap_".length()); if (NumberUtils.isDigits(directory)) { url = "<LINK_0>" + directory; } else { url = "<LINK_1>" + directory; } return url; }
Source:
public CopyImageToScreenNode(Context context) { WorldRenderer worldRenderer = context.get(WorldRenderer.class); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new BindFBO(DEFAULT_FBO, displayResolutionDependentFBOs)); update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }

Target:
public CopyImageToScreenNode(Context context) { super(context); WorldRenderer worldRenderer = context.get(WorldRenderer.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); addDesiredStateChange(new BindFBO(DEFAULT_FBO, displayResolutionDependentFBOs)); update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }
Source:
public static String[] getErrorParserExtensionIds() { return fExtensionErrorParsers.keySet().toArray(new String[0]); }

Target:
public static String[] getErrorParserExtensionIds() { return fExtensionErrorParsers.keySet().toArray(new String[fExtensionErrorParsers.size()]); }
Source:
public void logsIfFailedOperationsAreSlow() { RuntimeException exception = new RuntimeException("kaboom"); when(profilingTimelockService.getFreshTimestamp()).thenThrow(exception); makeOperationsTakeSpecifiedDuration(LONG_DURATION); allowLogging(); assertThatThrownBy(profilingTimelockService::getFreshTimestamp).isEqualTo(exception); verify(delegate).getFreshTimestamp(); verifyLoggerInvokedWithSpecificProfile("getFreshTimestamp", LONG_DURATION); }

Target:
public void logsIfFailedOperationsAreSlow() { RuntimeException exception = new RuntimeException("kaboom"); when(profilingTimelockService.getFreshTimestamp()).thenThrow(exception); assertThatThrownBy(() -> flushLogsWithCall(LONG_DURATION, profilingTimelockService::getFreshTimestamp)) .isEqualTo(exception); verify(delegate).getFreshTimestamp(); verifyLoggerInvokedOnceWithSpecificProfile("getFreshTimestamp", LONG_DURATION); verifyLoggerInvokedOnceWithException(exception); }
Source:
public SmeltingRecipeRegistry getSmeltingRecipeRegistry() { throw new UnsupportedOperationException(); }

Target:
public SmeltingRecipeRegistry getSmeltingRecipeRegistry() { return (SmeltingRecipeRegistry) FurnaceRecipes.instance(); }
Source:
private QueryParameters parseQuery(String query) throws ParseException, InvalidParametersException { QueryParameters q = new QueryParameters(); versions = new ArrayList<>(); if (query == null || query.isEmpty()) { return q; } String[] tokens = query.replaceAll(" and ", "|") .replaceAll(", ", ",") .replaceAll(": ", ":") .split("\\|", -1); for (String token : tokens) { String[] pair = token.split(":", -1); if (pair.length != 2) { throw new InvalidParametersException("Invalid format"); } String[] values = pair[1].split(",", -1); values = StringHelper.trim(values); String label = pair[0].trim(); if ("version".equals(label)) { for (String value : values) { versions.add(value.replace(".", "-")); } } else if ("from".equals(label)) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yy"); fromDateValue = LocalDate.parse(values[0], formatter) .atStartOfDay(Const.SystemParams.ADMIN_TIME_ZONE_ID).toInstant().toEpochMilli(); isFromDateSpecifiedInQuery = true; } else if ("to".equals(label)) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yy"); toDateValue = LocalDate.parse(values[0], formatter).atTime(23, 59) .atZone(Const.SystemParams.ADMIN_TIME_ZONE_ID).toInstant().toEpochMilli(); } else { q.add(label, values); } } return q; }

Target:
private QueryParameters parseQuery(String query) throws ParseException, InvalidParametersException { QueryParameters q = new QueryParameters(); versions = new ArrayList<>(); if (query == null || query.isEmpty()) { return q; } String[] tokens = query.replaceAll(" and ", "|") .replaceAll(", ", ",") .replaceAll(": ", ":") .split("\\|", -1); for (String token : tokens) { String[] pair = token.split(":", -1); if (pair.length != 2) { throw new InvalidParametersException("Invalid format"); } String[] values = pair[1].split(",", -1); values = StringHelper.trim(values); String label = pair[0].trim(); if ("version".equals(label)) { for (String value : values) { versions.add(value.replace(".", "-")); } } else if ("from".equals(label)) { fromDateValue = LocalDate.parse(values[0], DateTimeFormatter.ofPattern("dd/MM/yy")) .atStartOfDay(Const.SystemParams.ADMIN_TIME_ZONE_ID).toInstant().toEpochMilli(); isFromDateSpecifiedInQuery = true; } else if ("to".equals(label)) { toDateValue = LocalDate.parse(values[0], DateTimeFormatter.ofPattern("dd/MM/yy")) .atTime(LocalTime.MAX).atZone(Const.SystemParams.ADMIN_TIME_ZONE_ID).toInstant().toEpochMilli(); } else { q.add(label, values); } } return q; }
Source:
protected void doAccept(HandlerEvent event) { LOGGER.debug("Accepting Database restore event..."); DatabaseRestoreRequest request = event.getData(); Selectable result; Long stackId = request.getResourceId(); try { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = stack.getCluster(); InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance(); GatewayConfig gatewayConfig = gatewayConfigService.getGatewayConfig(stack, gatewayInstance, cluster.getGateway() != null); Set<String> gatewayFQDN = Collections.singleton(gatewayInstance.getDiscoveryFQDN()); ExitCriteriaModel exitModel = ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(stackId, cluster.getId()); SaltConfig saltConfig = saltConfigGenerator.createSaltConfig(request.getBackupLocation(), request.getBackupId(), stack.getCloudPlatform()); hostOrchestrator.restoreDatabase(gatewayConfig, gatewayFQDN, stackUtil.collectReachableNodes(stack), saltConfig, exitModel); result = new DatabaseRestoreSuccess(stackId); } catch (Exception e) { LOGGER.error("Database restore event failed", e); result = new DatabaseRestoreFailedEvent(stackId, e, DetailedStackStatus.DATABASE_RESTORE_FAILED); } sendEvent(result, event); }

Target:
protected void doAccept(HandlerEvent event) { DatabaseRestoreRequest request = event.getData(); Selectable result; Long stackId = request.getResourceId(); LOGGER.debug("Restoring database on stack {}, backup id {}", stackId, request.getBackupId()); try { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = stack.getCluster(); InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance(); GatewayConfig gatewayConfig = gatewayConfigService.getGatewayConfig(stack, gatewayInstance, cluster.hasGateway()); Set<String> gatewayFQDN = Collections.singleton(gatewayInstance.getDiscoveryFQDN()); ExitCriteriaModel exitModel = ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(stackId, cluster.getId()); SaltConfig saltConfig = saltConfigGenerator.createSaltConfig(request.getBackupLocation(), request.getBackupId(), stack.getCloudPlatform()); hostOrchestrator.restoreDatabase(gatewayConfig, gatewayFQDN, stackUtil.collectReachableNodes(stack), saltConfig, exitModel); result = new DatabaseRestoreSuccess(stackId); } catch (Exception e) { LOGGER.error("Database restore event failed", e); result = new DatabaseRestoreFailedEvent(stackId, e, DetailedStackStatus.DATABASE_RESTORE_FAILED); } sendEvent(result, event); }
Source:
private void runAutodefineForOneProvider(Guid providerId, int index) { Network externalNetwork = createExternalNetwork(getNetworkName(index), providerId); AddNetworkStoragePoolParameters storagePoolParameters = new AddNetworkStoragePoolParameters(getNetwork().getStoragePoolId(), externalNetwork); storagePoolParameters.setVnicProfileRequired(false); ActionReturnValue returnValue = runInternalAction(ActionType.AddNetworkOnProvider, storagePoolParameters); if (returnValue.getSucceeded()) { Guid networkId = returnValue.getActionReturnValue(); networkHelper.attachNetworkToClusters(networkId, listOfClustersByProvider.get(providerId)); externalNetwork.setId(networkId); addVnicProfile(externalNetwork); } }

Target:
private void runAutodefineForOneProvider(Guid providerId, int index) { Network externalNetwork = createExternalNetwork(getNetworkName(index), providerId); AddNetworkStoragePoolParameters storagePoolParameters = new AddNetworkStoragePoolParameters(getNetwork().getStoragePoolId(), externalNetwork); storagePoolParameters.setVnicProfileRequired(false); ActionReturnValue returnValue = runInternalAction(ActionType.AddNetworkOnProvider, storagePoolParameters); if (returnValue.getSucceeded()) { Guid networkId = returnValue.getActionReturnValue(); networkHelper.attachNetworkToClusters(networkId, clustersByProvider.get(providerId)); externalNetwork.setId(networkId); networkHelper.addVnicProfileWithoutFilter(externalNetwork, true); } }
Source:
public String create(final String path, final Object dataObject, final List<ACL> acl, final CreateMode mode, final String expectedSessionId) throws IllegalArgumentException, ZkException { if (path == null) { throw new NullPointerException("Path must not be null."); } if (acl == null || acl.size() == 0) { throw new NullPointerException("Missing value for ACL"); } long startT = System.currentTimeMillis(); try { final byte[] dataBytes = dataObject == null ? null : serialize(dataObject, path); checkDataSizeLimit(dataBytes); final String actualPath = retryUntilConnected(() -> { ZooKeeper zooKeeper = ((ZkConnection) getConnection()).getZookeeper(); if (isSessionAwareOperation(expectedSessionId, mode)) { acquireEventLock(); try { final String actualSessionId = toHexSessionId(zooKeeper.getSessionId()); if (!actualSessionId.equals(expectedSessionId)) { throw new ZkSessionMismatchedException( "Failed to create ephemeral node! There is a session id mismatch. Expected: " + expectedSessionId + ". Actual: " + actualSessionId); } zooKeeper = ((ZkConnection) getConnection()).getZookeeper(); } finally { getEventLock().unlock(); } } return zooKeeper.create(path, dataBytes, acl, mode); }); record(path, dataBytes, startT, ZkClientMonitor.AccessType.WRITE); return actualPath; } catch (Exception e) { recordFailure(path, ZkClientMonitor.AccessType.WRITE); throw e; } finally { long endT = System.currentTimeMillis(); if (LOG.isTraceEnabled()) { LOG.trace("create, path: " + path + ", time: " + (endT - startT) + " ms"); } } }

Target:
private String create(final String path, final Object dataObject, final List<ACL> acl, final CreateMode mode, final String expectedSessionId) throws IllegalArgumentException, ZkException { if (path == null) { throw new NullPointerException("Path must not be null."); } if (acl == null || acl.size() == 0) { throw new NullPointerException("Missing value for ACL"); } long startT = System.currentTimeMillis(); try { final byte[] dataBytes = dataObject == null ? null : serialize(dataObject, path); checkDataSizeLimit(dataBytes); final String actualPath = retryUntilConnected(() -> { ZooKeeper zooKeeper = ((ZkConnection) getConnection()).getZookeeper(); if (isSessionAwareOperation(expectedSessionId, mode)) { acquireEventLock(); try { final String actualSessionId = toHexSessionId(zooKeeper.getSessionId()); if (!actualSessionId.equals(expectedSessionId)) { throw new ZkSessionMismatchedException( "Failed to create ephemeral node! There is a session id mismatch. Expected: " + expectedSessionId + ". Actual: " + actualSessionId); } zooKeeper = ((ZkConnection) getConnection()).getZookeeper(); } finally { getEventLock().unlock(); } } return zooKeeper.create(path, dataBytes, acl, mode); }); record(path, dataBytes, startT, ZkClientMonitor.AccessType.WRITE); return actualPath; } catch (Exception e) { recordFailure(path, ZkClientMonitor.AccessType.WRITE); throw e; } finally { long endT = System.currentTimeMillis(); if (LOG.isTraceEnabled()) { LOG.trace("create, path: " + path + ", time: " + (endT - startT) + " ms"); } } }
Source:
public void testIssue827() { RMap<String, Object> mapCache = redisson.getMap("test_put_if_absent", StringCodec.INSTANCE); mapCache.putIfAbsent("4", 0L); mapCache.addAndGet("4", 1L); mapCache.putIfAbsent("4", 0L); System.out.println(mapCache.get("4")); }

Target:
public void testIssue827() { RMapCache<String, Object> mapCache = redisson.getMapCache("test_put_if_absent", StringCodec.INSTANCE); mapCache.putIfAbsent("4", 0L, 10000L, TimeUnit.SECONDS); mapCache.addAndGet("4", 1L); mapCache.putIfAbsent("4", 0L); Assert.assertEquals("1", mapCache.get("4")); mapCache = redisson.getMapCache("test_put_if_absent_1", StringCodec.INSTANCE); mapCache.putIfAbsent("4", 0L); mapCache.addAndGet("4", 1L); mapCache.putIfAbsent("4", 0L); Assert.assertEquals("1", mapCache.get("4")); RMap map = redisson.getMap("test_put_if_absent_2", StringCodec.INSTANCE); map.putIfAbsent("4", 0L); map.addAndGet("4", 1L); map.putIfAbsent("4", 0L); Assert.assertEquals("1", map.get("4")); RMapCache<String, Object> mapCache1 = redisson.getMapCache("test_put_if_absent_3"); Object currValue = mapCache1.putIfAbsent("4", 1.23, 10000L, TimeUnit.SECONDS); Object updatedValue = mapCache1.addAndGet("4", 1D); System.out.println("updatedValue: " + updatedValue); Assert.assertEquals(2.23, mapCache1.get("4")); }
Source:
public IStatus runInWorkspace(IProgressMonitor monitor) { long start = System.currentTimeMillis(); String msg = Messages.refresh_refreshErr; MultiStatus errors = new MultiStatus(ResourcesPlugin.PI_RESOURCES, 1, msg, null); long longestRefresh = 0; SubMonitor subMonitor = SubMonitor.convert(monitor); try { if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(RefreshManager.DEBUG_PREFIX + " starting refresh job"); int refreshCount = 0; int depth = 2; IResource toRefresh; while ((toRefresh = nextRequest()) != null) { try { subMonitor.setWorkRemaining(fRequests.size()); refreshCount++; long refreshTime = -System.currentTimeMillis(); toRefresh.refreshLocal(1000 + depth, subMonitor.split(1)); refreshTime += System.currentTimeMillis(); if (refreshTime > longestRefresh) longestRefresh = refreshTime; if (refreshCount % 1000 == 0) { Thread.yield(); if (longestRefresh > 2000 && depth > 1) { depth = 1; } if (longestRefresh < 1000) { depth *= 2; } longestRefresh = 0; } addRequests(collectChildrenToDepth(toRefresh, new ArrayList<IResource>(), depth)); } catch (CoreException e) { errors.merge(new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, 1, errors.getMessage(), e)); } } } finally { pathPrefixHistory = null; rootPathHistory = null; subMonitor.setWorkRemaining(0); if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(RefreshManager.DEBUG_PREFIX + " finished refresh job in: " + (System.currentTimeMillis() - start) + "ms"); } if (!errors.isOK()) return errors; return Status.OK_STATUS; }

Target:
public IStatus runInWorkspace(IProgressMonitor monitor) { long start = System.currentTimeMillis(); String msg = Messages.refresh_refreshErr; MultiStatus errors = new MultiStatus(ResourcesPlugin.PI_RESOURCES, 1, msg, null); long longestRefresh = 0; SubMonitor subMonitor = SubMonitor.convert(monitor); try { if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(RefreshManager.DEBUG_PREFIX + " starting refresh job"); int refreshCount = 0; int depth = 2; IResource toRefresh; while ((toRefresh = nextRequest()) != null) { try { subMonitor.setWorkRemaining(Math.max(fRequests.size(), 10)); refreshCount++; long refreshTime = -System.currentTimeMillis(); toRefresh.refreshLocal(1000 + depth, subMonitor.split(1)); refreshTime += System.currentTimeMillis(); if (refreshTime > longestRefresh) longestRefresh = refreshTime; if (refreshCount % 1000 == 0) { Thread.yield(); if (longestRefresh > 2000 && depth > 1) { depth = 1; } if (longestRefresh < 1000) { depth *= 2; } longestRefresh = 0; } addRequests(collectChildrenToDepth(toRefresh, new ArrayList<IResource>(), depth)); } catch (CoreException e) { errors.merge(new Status(IStatus.ERROR, ResourcesPlugin.PI_RESOURCES, 1, errors.getMessage(), e)); } } } finally { pathPrefixHistory = null; rootPathHistory = null; if (Policy.DEBUG_AUTO_REFRESH) Policy.debug(RefreshManager.DEBUG_PREFIX + " finished refresh job in: " + (System.currentTimeMillis() - start) + "ms"); } if (!errors.isOK()) return errors; return Status.OK_STATUS; }
Source:
private Pair<DiskImage, Long> getLatestOVFDisk(List<Disk> disks) { Date lastUpdate = new Date(); boolean lastIsUpdated = false; Long size = 0L; Disk diskToGetOVF = null; for (Disk disk : disks) { boolean isDiskLastUpdated = false; String diskDecription = ((DiskImage) disk).getDescription(); if (diskDecription.contains(OvfInfoFileConstants.OvfStoreDescriptionLabel)) { Map<String, Object> diskDescriptionMap = buildJson(diskDecription); if (!isDomainExistsInDiskDescription(diskDescriptionMap, getParameters().getStorageDomainId())) { break; } boolean isUpdated = Boolean.valueOf(diskDescriptionMap.get(OvfInfoFileConstants.IsUpdated).toString()); Date date = getDateFromDiskDescription(diskDescriptionMap); if (!lastIsUpdated && isUpdated) { isDiskLastUpdated = true; } else if (!isUpdated && date.after(lastUpdate)) { isDiskLastUpdated = true; } else if (lastIsUpdated && isUpdated && date.after(lastUpdate)) { isDiskLastUpdated = true; } if (isDiskLastUpdated) { lastIsUpdated = isUpdated; lastUpdate = date; diskToGetOVF = disk; size = new Long(diskDescriptionMap.get(OvfInfoFileConstants.Size).toString()); } } } return new Pair<>((DiskImage)diskToGetOVF, size); }

Target:
private Pair<DiskImage, Long> getLatestOVFDisk(List<Disk> disks) { Date foundOvfDiskUpdateDate = new Date(); boolean isFoundOvfDiskUpdated = false; Long size = 0L; Disk ovfDisk = null; for (Disk disk : disks) { boolean isBetterOvfDiskFound = false; String diskDecription = ((DiskImage) disk).getDescription(); if (diskDecription.contains(OvfInfoFileConstants.OvfStoreDescriptionLabel)) { Map<String, Object> diskDescriptionMap; try { diskDescriptionMap = JsonHelper.jsonToMap(diskDecription); } catch (IOException e) { log.errorFormat("Exception while generating json containing ovf store info. Exception: {0}", e); continue; } if (!isDomainExistsInDiskDescription(diskDescriptionMap, getParameters().getStorageDomainId())) { log.warnFormat("The disk description does not contain the storage domain id {0}", getParameters().getStorageDomainId()); continue; } boolean isUpdated = Boolean.valueOf(diskDescriptionMap.get(OvfInfoFileConstants.IsUpdated).toString()); Date date = getDateFromDiskDescription(diskDescriptionMap); if (!isFoundOvfDiskUpdated && isUpdated) { isBetterOvfDiskFound = true; } else if (!isUpdated && date.after(foundOvfDiskUpdateDate)) { isBetterOvfDiskFound = true; } else if (isFoundOvfDiskUpdated && isUpdated && date.after(foundOvfDiskUpdateDate)) { isBetterOvfDiskFound = true; } if (isBetterOvfDiskFound) { isFoundOvfDiskUpdated = isUpdated; foundOvfDiskUpdateDate = date; ovfDisk = disk; size = new Long(diskDescriptionMap.get(OvfInfoFileConstants.Size).toString()); } } } return new Pair<>((DiskImage)ovfDisk, size); }
Source:
public IterableStream<EventData> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw new IllegalArgumentException("'maximumMessageCount' cannot be less than 1."); } else if (maximumWaitTime.isNegative() || maximumWaitTime.isZero()) { throw new IllegalArgumentException("'maximumWaitTime' cannot be zero or less."); } final Flux<EventData> events = Flux.create(emitter -> { queueWork(maximumMessageCount, maximumWaitTime, emitter); }); final Flux<EventData> map = events.collectList().map(Flux::fromIterable).block(); return new IterableStream<>(map); }

Target:
public IterableStream<EventData> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1.")); } else if (maximumWaitTime.isNegative() || maximumWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumWaitTime' cannot be zero or less.")); } final Flux<EventData> events = Flux.create(emitter -> { queueWork(maximumMessageCount, maximumWaitTime, emitter); }); final Flux<EventData> map = events.collectList().map(x -> { logger.info("Number of events received: {}", x.size()); return Flux.fromIterable(x); }).block(); return new IterableStream<>(map); }
Source:
public void generateAndWrite(AnnotationExtractionRequest request) throws IOException { AnnotationExtractionResponse response = annotationExtractionService.extract(request); writerGenerator.generateWriters(request.getElement(), response).forEach(writer -> { try { writer.write(); } catch (IOException e) { e.printStackTrace(); } }); }

Target:
public void generateAndWrite(AnnotationExtractionRequest request) throws IOException { this.generateWriters(request).forEach(writer -> { try { writer.write(); } catch (IOException e) { e.printStackTrace(); } }); }
Source:
private void mergeAndPush() { final Granularity segmentGranularity = schema.getGranularitySpec().getSegmentGranularity(); final Period windowPeriod = config.getWindowPeriod(); final long windowMillis = windowPeriod.toStandardDuration().getMillis(); log.info("Starting merge and push."); DateTime minTimestampAsDate; try { minTimestampAsDate = segmentGranularity.truncate(rejectionPolicy.getCurrMaxTime().minus(windowMillis)); } catch (ArithmeticException e) { minTimestampAsDate = segmentGranularity.truncate(rejectionPolicy.getCurrMaxTime()); } long minTimestamp = minTimestampAsDate.getMillis(); log.info("Found [%,d] sinks. minTimestamp [%s]", sinks.size(), minTimestampAsDate); List<Map.Entry<Long, Sink>> sinksToPush = Lists.newArrayList(); for (Map.Entry<Long, Sink> entry : sinks.entrySet()) { final Long intervalStart = entry.getKey(); if (intervalStart < minTimestamp) { log.info("Adding entry[%s] for merge and push.", entry); sinksToPush.add(entry); } else { log.warn( "[%s] < [%s] Skipping persist and merge.", new DateTime(intervalStart), minTimestampAsDate ); } } log.info("Found [%,d] sinks to persist and merge", sinksToPush.size()); for (final Map.Entry<Long, Sink> entry : sinksToPush) { persistAndMerge(entry.getKey(), entry.getValue()); } }

Target:
private void mergeAndPush() { final Granularity segmentGranularity = schema.getGranularitySpec().getSegmentGranularity(); final Period windowPeriod = config.getWindowPeriod(); final long windowMillis = windowPeriod.toStandardDuration().getMillis(); log.info("Starting merge and push."); DateTime minTimestampAsDate = new DateTime(Math.max(windowMillis, rejectionPolicy.getCurrMaxTime().getMillis()) - windowMillis); long minTimestamp = minTimestampAsDate.getMillis(); log.info("Found [%,d] sinks. minTimestamp [%s]", sinks.size(), minTimestampAsDate); List<Map.Entry<Long, Sink>> sinksToPush = Lists.newArrayList(); for (Map.Entry<Long, Sink> entry : sinks.entrySet()) { final Long intervalStart = entry.getKey(); if (intervalStart < minTimestamp) { log.info("Adding entry[%s] for merge and push.", entry); sinksToPush.add(entry); } else { log.warn( "[%s] < [%s] Skipping persist and merge.", new DateTime(intervalStart), minTimestampAsDate ); } } log.info("Found [%,d] sinks to persist and merge", sinksToPush.size()); for (final Map.Entry<Long, Sink> entry : sinksToPush) { persistAndMerge(entry.getKey(), entry.getValue()); } }
Source:
protected RetryState getRetryState(BackOff backoff) { long nextBackOffMillis = 0; try { nextBackOffMillis = backoff.nextBackOffMillis(); if (nextBackOffMillis == BackOff.STOP) { return RetryState.RetriesExhausted; } else { try { sleeper.sleep(nextBackOffMillis); } catch (InterruptedException e) { Thread.interrupted(); return RetryState.Interrupted; } return RetryState.PerformRetry; } } catch (IOException e) { return RetryState.UnknownException; } }

Target:
protected RetryState getRetryState(BackOff backoff) throws IOException{ long nextBackOffMillis = backoff.nextBackOffMillis(); if (nextBackOffMillis == BackOff.STOP) { LOG.warn("Exhausted the number of retries for credentials refresh after " + this.retryOptions.getMaxElaspedBackoffMillis() + " milliseconds."); return RetryState.RetriesExhausted; } try { sleeper.sleep(nextBackOffMillis); return RetryState.PerformRetry; } catch (InterruptedException e) { LOG.warn("Interrupted while trying to refresh credentials."); Thread.interrupted(); return RetryState.Interrupted; } }
Source:
public static List<String> loadRerunFile(ResourceLoader resourceLoader, String rerunPath) { List<String> featurePaths = new ArrayList<String>(); Iterable<Resource> resources = resourceLoader.resources(rerunPath, null); for (Resource resource : resources) { String source = read(resource); if (!source.isEmpty()) { Matcher matcher = RERUN_PATH_SPECIFICATION.matcher(source); while(matcher.find()){ featurePaths.add(matcher.group(1)); } } } return featurePaths; }

Target:
public static List<PathWithLines> loadRerunFile(ResourceLoader resourceLoader, String rerunPath) { List<PathWithLines> featurePaths = new ArrayList<PathWithLines>(); Iterable<Resource> resources = resourceLoader.resources(rerunPath, null); for (Resource resource : resources) { String source = read(resource); if (!source.isEmpty()) { Matcher matcher = RERUN_PATH_SPECIFICATION.matcher(source); while(matcher.find()){ featurePaths.add(new PathWithLines(matcher.group(1))); } } } return featurePaths; }
Source:
public void close() throws SQLException { keyIterator = null; keyList = null; hash = null; memoryChunk.resize(0); resultIterator.close(); }

Target:
public void close() throws SQLException { keyIterator = null; keyList = null; hash = null; try { memoryChunk.close(); } finally { resultIterator.close(); } }
Source:
public void performAlign(int offset, int width) { int plotAreaOffset = fChartViewer.getPointAreaOffset(); int sashOffset = Math.max(1, offset - plotAreaOffset); int total = fSashForm.getBounds().width; int width1 = (int) (sashOffset / (float) total * 1000); int width2 = (int) ((total - sashOffset) / (float) total * 1000); fSashForm.setWeights(new int[] { width1, width2 }); fSashForm.layout(); }

Target:
public void performAlign(int offset, int width) { int plotAreaOffset = fChartViewer.getPointAreaOffset(); int sashOffset = Math.max(1, offset - plotAreaOffset); int total = fSashForm.getBounds().width; int width1 = (int) (sashOffset / (float) total * 1000); int width2 = (int) ((total - sashOffset) / (float) total * 1000); fSashForm.setWeights(new int[] { width1, width2 }); fSashForm.layout(); Composite composite = fXYViewerContainer; GridLayout layout = (GridLayout) composite.getLayout(); int timeAxisWidth = getAvailableWidth(offset); int marginSize = timeAxisWidth - width; layout.marginRight = Math.max(0, marginSize); composite.layout(); }
Source:
public void startup( Workspace workspace ) { this.workspace = workspace; try { for ( Driver d : ServiceLoader.load( Driver.class, workspace.getModuleClassLoader() ) ) { registerDriver( new DriverWrapper( d ) ); registerDriver( new DriverWrapper( new org.sqlite.JDBC() ) ); LOG.info( "Found and loaded {}", d.getClass().getName() ); } } catch ( SQLException e ) { LOG.debug( "Unable to load driver: {}", e.getLocalizedMessage() ); } super.startup( workspace ); }

Target:
public void startup( Workspace workspace ) { this.workspace = workspace; try { for ( Driver d : ServiceLoader.load( Driver.class, workspace.getModuleClassLoader() ) ) { registerDriver( new DriverWrapper( d ) ); LOG.info( "Found and loaded {}", d.getClass().getName() ); } } catch ( SQLException e ) { LOG.debug( "Unable to load driver: {}", e.getLocalizedMessage() ); ClassLoader moduleClassLoader = workspace.getModuleClassLoader(); for ( Driver d : ServiceLoader.load( Driver.class, moduleClassLoader ) ) { warnIfDriversAreRegisteredInModulesClassLoader( moduleClassLoader, d ); } super.startup( workspace ); } @Override public void shutdown() { } private void warnIfDriversAreRegisteredInModulesClassLoader( ClassLoader moduleClassLoader, Driver d ) { final String clsName = d.getClass().getName(); String clsFile = createClsFile( moduleClassLoader, clsName ); LOG.warn( "The JDBC driver has been found in the modules directory.", clsName ); LOG.warn( "This method of loading JDBC drivers is not supported in deegree any more." ); LOG.warn( "Please check the webservices handbook for more infomation." ); if ( clsFile != null ) { LOG.warn( "The jdbc driver has been found at {}", clsFile ); } } private String createClsFile( ClassLoader moduleClassLoader, final String clsName ) { String clsFile; try { clsFile = moduleClassLoader.getResource( clsName.replace( '.', '/' ) + ".class" ).toString(); } catch ( Exception ign ) { return null; } if ( clsFile == null || clsFile.length() == 0 ) return null; int jarpos = clsFile.indexOf( ".jar" ); if ( jarpos != -1 ) { clsFile = clsFile.substring( 0, jarpos + 4 ); } return clsFile; } }
Source:
private String[] getSubclassNameClosureBySubclassTable(int subclassTableNumber) { final int index = subclassTableNumber - getTableSpan(); if ( index >= subclassNamesBySubclassTable.length ) { throw new IllegalArgumentException( "Given subclass table number is outside expected range [" + subclassNamesBySubclassTable.length + "] as defined by subclassTableNameClosure/subclassClosure" ); } return subclassNamesBySubclassTable[index]; }

Target:
private String[] getSubclassNameClosureBySubclassTable(int subclassTableNumber) { final int index = subclassTableNumber - getTableSpan(); if ( index >= subclassNamesBySubclassTable.length ) { throw new IllegalArgumentException( "Given subclass table number is outside expected range [" + (subclassNamesBySubclassTable.length -1) + "] as defined by subclassTableNameClosure/subclassClosure" ); } return subclassNamesBySubclassTable[index]; }
Source:
private String getTemplateExclusiveLockMessage() { if (getVmTemplate() != null) { return new StringBuilder(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_IS_BEING_REMOVED.name()) .append(String.format("$TemplateName %1$s", getVmTemplate().getName())) .toString(); } return VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED.name(); }

Target:
private String getTemplateExclusiveLockMessage() { return new StringBuilder(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_IS_BEING_REMOVED.name()) .append(String.format("$TemplateName %1$s", getVmTemplate().getName())) .toString(); }
Source:
private void createStoreThumb(String dsIrodsPath, int width, int height, String dsname, boolean exists, List<String> thumbRels) throws Exception { long start = System.currentTimeMillis(); String resultPath = runConvertScaleStage(dsIrodsPath, "PNG", width, height); LOG.debug("Generated image in {}ms", dsname, (System.currentTimeMillis() - start)); String resultURI = ((AbstractIrodsObjectEnhancementService) service).makeIrodsURIFromPath(resultPath); start = System.currentTimeMillis(); if (!exists) { String message = "adding thumbnail"; client.addManagedDatastream(pid, dsname, false, message, Collections.<String> emptyList(), "Thumbnail Image", false, "image/png", resultURI); } else { String message = "updating thumbnail"; client.modifyDatastreamByReference(pid, dsname, false, message, new ArrayList<String>(), "Thumbnail Image", "image/png", null, null, resultURI); } LOG.debug("Added datastream in {}ms", dsname, (System.currentTimeMillis() - start)); start = System.currentTimeMillis(); ((AbstractIrodsObjectEnhancementService) service).deleteIRODSFile(resultPath); LOG.debug("Cleaned up irods file in {}ms", dsname, (System.currentTimeMillis() - start)); }

Target:
private void createStoreThumb(String dsIrodsPath, int width, int height, String dsname, boolean exists, List<String> thumbRels) throws Exception { long convertStart = System.currentTimeMillis(); String resultPath = runConvertScaleStage(dsIrodsPath, "PNG", width, height); LOG.debug("Generated image in {}ms", dsname, (System.currentTimeMillis() - convertStart)); String resultURI = ((AbstractIrodsObjectEnhancementService) service).makeIrodsURIFromPath(resultPath); long addDsStart = System.currentTimeMillis(); if (!exists) { String message = "adding thumbnail"; client.addManagedDatastream(pid, dsname, false, message, Collections.<String> emptyList(), "Thumbnail Image", false, "image/png", resultURI); } else { String message = "updating thumbnail"; client.modifyDatastreamByReference(pid, dsname, false, message, new ArrayList<String>(), "Thumbnail Image", "image/png", null, null, resultURI); } LOG.debug("Added datastream in {}ms", dsname, (System.currentTimeMillis() - addDsStart)); long deleteStart = System.currentTimeMillis(); ((AbstractIrodsObjectEnhancementService) service).deleteIRODSFile(resultPath); LOG.debug("Cleaned up irods file in {}ms", dsname, (System.currentTimeMillis() - deleteStart)); }
Source:
public String getSignature() { return "haversine_dist_degree(DD)"; }

Target:
public String getSignature() { return "haversine_dist_deg(DDN)"; }
Source:
public void addInputPort(InputPort<?> portObject, Field field, InputPortFieldAnnotation portAnnotation, AppData.QueryPort adqAnnotation) { if (!OperatorMeta.this.inputStreams.isEmpty()) { for (Map.Entry<LogicalPlan.InputPortMeta, LogicalPlan.StreamMeta> e : OperatorMeta.this.inputStreams.entrySet()) { LogicalPlan.InputPortMeta pm = e.getKey(); if (pm.operatorMeta == OperatorMeta.this && pm.fieldName.equals(field.getName())) { inPortMap.put(portObject, pm); markInputPortIfHidden(pm.getPortName(), pm, field.getDeclaringClass()); return; } } } InputPortMeta metaPort = new InputPortMeta(); metaPort.operatorMeta = OperatorMeta.this; metaPort.fieldName = field.getName(); metaPort.portAnnotation = portAnnotation; metaPort.adqAnnotation = adqAnnotation; inPortMap.put(portObject, metaPort); markInputPortIfHidden(metaPort.getPortName(), metaPort, field.getDeclaringClass()); if (metaPort.getStreamCodec() == null) { metaPort.setStreamCodec(portObject.getStreamCodec()); } else if (portObject.getStreamCodec() != null) { LOG.info("Input port overwrites codec with {}.", metaPort, metaPort.getStreamCodec(), portObject.getStreamCodec()); } }

Target:
public void addInputPort(InputPort<?> portObject, Field field, InputPortFieldAnnotation portAnnotation, AppData.QueryPort adqAnnotation) { if (!OperatorMeta.this.inputStreams.isEmpty()) { for (Map.Entry<LogicalPlan.InputPortMeta, LogicalPlan.StreamMeta> e : OperatorMeta.this.inputStreams.entrySet()) { LogicalPlan.InputPortMeta pm = e.getKey(); if (pm.operatorMeta == OperatorMeta.this && pm.fieldName.equals(field.getName())) { inPortMap.put(portObject, pm); markInputPortIfHidden(pm.getPortName(), pm, field.getDeclaringClass()); return; } } } InputPortMeta metaPort = new InputPortMeta(); metaPort.operatorMeta = OperatorMeta.this; metaPort.fieldName = field.getName(); metaPort.portAnnotation = portAnnotation; metaPort.adqAnnotation = adqAnnotation; inPortMap.put(portObject, metaPort); markInputPortIfHidden(metaPort.getPortName(), metaPort, field.getDeclaringClass()); if (metaPort.getStreamCodec() == null) { metaPort.setStreamCodec(portObject.getStreamCodec()); } else if (portObject.getStreamCodec() != null) { LOG.info("Input port attribute overrides codec with codec", metaPort.getPortName(), STREAM_CODEC.getSimpleName(), portObject.getStreamCodec(), metaPort.getStreamCodec()); } }