auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void push(RowMap r) throws InterruptedException, Exception { String original_topic_per_table = this.context.getKafkaTopicPerTableFormat(); if(original_topic_per_table.contains("%{database}") || original_topic_per_table.contains("%{table}")) { String db_name = r.getDatabase(); String kafkaTopicWithFormat = original_topic_per_table.replaceAll("%\\{database\\}", db_name); String table_name = r.getTable(); this.topic = kafkaTopicWithFormat.replaceAll("%\\{table\\}", table_name); List<PartitionInfo> partitions_for_kafka; try { partitions_for_kafka = this.kafka.partitionsFor(this.topic); } catch(TimeoutException e) { LOGGER.error("This topic name does not exist: " + this.topic + ": " + e.getLocalizedMessage()); throw (e); } <START> } <END> String key = r.pkToJson(keyFormat); String value = r.toJSON(); ProducerRecord<String, String> record = new ProducerRecord<>(topic, this.partitioner.kafkaPartition(r, this.numPartitions), key, value); if ( r.isTXCommit() ) inflightMessages.addMessage(r.getPosition()); if ( !KafkaCallback.LOGGER.isDebugEnabled() ) value = null; KafkaCallback callback = new KafkaCallback(inflightMessages, r.getPosition(), r.isTXCommit(), this.context, key, value); kafka.send(record, callback); }</code><technical_language>hoist of this a getTopic() private function</technical_language>

Target:
public void push(RowMap r) throws Exception { String kafkaTopicWithFormat = getTopic(r); if(kafkaTopicWithFormat != "") { this.topic = kafkaTopicWithFormat; } String key = r.pkToJson(keyFormat); String value = r.toJSON(); int numPartitions = getKafkaNumPartition(r); ProducerRecord<String, String> record = new ProducerRecord<>(topic, this.partitioner.kafkaPartition(r, numPartitions), key, value); if ( r.isTXCommit() ) inflightMessages.addMessage(r.getPosition()); if ( !KafkaCallback.LOGGER.isDebugEnabled() ) value = null; KafkaCallback callback = new KafkaCallback(inflightMessages, r.getPosition(), r.isTXCommit(), this.context, key, value); kafka.send(record, callback); }
Source:
<code>protected void internalReceiveCommand(String itemName, Command command) { logger.debug("internalReceiveCommand({},{}) is called!", itemName, command); State newState = null; if(command instanceof OnOffType) { newState = (OnOffType) command; } else if(command instanceof OpenClosedType) { newState = (OpenClosedType) command; } else if(command instanceof PercentType) { newState = (PercentType) command; } else if(command instanceof DecimalType) { newState = (DecimalType) command; } if(newState != null) { eventPublisher.postUpdate(itemName, newState); } else { logger.warn("internalReceiveCommand({},{}) not handled!", itemName, command); } <START> } <END></code><technical_language>i purpose of this method? internalReceiveCommand is called due events posted EventPublisher produce a loop, right? I suggest remove this this method is intended communicate openHAB internal commands external hardware</technical_language>

Target:
protected void internalReceiveCommand(String itemName, Command command) { logger.debug("internalReceiveCommand({},{}) is called!", itemName, command); State newState = null; if (command instanceof OnOffType) { newState = (OnOffType) command; } else if (command instanceof OpenClosedType) { newState = (OpenClosedType) command; } else if (command instanceof PercentType) { newState = (PercentType) command; } else if (command instanceof DecimalType) { newState = (DecimalType) command; } if (newState != null) { eventPublisher.postUpdate(itemName, newState); } }
Source:
<code>public VDSReturnValue get(long timeout, TimeUnit unit) throws TimeoutException { try { status = new StatusOnlyReturnForXmlRpc(httpTask.get(timeout, unit)); proceedProxyReturnValue(); } catch (TimeoutException e) { httpTask.cancel(true); VDSNetworkException ex = new VDSNetworkException("Timeout during xml-rpc call"); ex.setVdsError(new VDSError(VdcBllErrors.VDS_NETWORK_ERROR, "Timeout during xml-rpc call")); setVdsRuntimeError(ex); log.error("Timeout waiting for VDSM response: {}", e.getMessage()); log.debug("Exception", e); throw e; } catch (Exception e) { log.error("Error: {}", e.getMessage()); <START> if (VDSErrorException.class.isInstance(e) <END> && !"Policy reset".equals(((VDSExceptionBase) e).getVdsError().getMessage())) { log.error("Exception", e); } setVdsRuntimeError(e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e)); } return getVDSReturnValue(); }</code><technical_language>introduce a specific catch case for specific exception type</technical_language>

Target:
public VDSReturnValue get(long timeout, TimeUnit unit) throws TimeoutException { try { status = new StatusOnlyReturnForXmlRpc(httpTask.get(timeout, unit)); proceedProxyReturnValue(); } catch (TimeoutException e) { httpTask.cancel(true); VDSNetworkException ex = new VDSNetworkException("Timeout during xml-rpc call"); ex.setVdsError(new VDSError(VdcBllErrors.VDS_NETWORK_ERROR, "Timeout during xml-rpc call")); setVdsRuntimeError(ex); log.error("Timeout waiting for VDSM response: {}", e.getMessage()); log.debug("Exception", e); throw e; } catch (VDSNetworkException e) { if (!"Policy reset".equals(e.getVdsError().getMessage())) { log.error("Exception", e); } setVdsExceptionAndLog(e); } catch (Exception e) { log.error("Exception", e); setVdsExceptionAndLog(e); } return getVDSReturnValue(); }
Source:
<code>public static Object getResponse(Object result, HttpServletRequest request, int httpStatus) throws IOException, MessagingException { if (result == null || "true".equals(request.getHeader("X-NXVoidOperation"))) { return emptyContent(); } if (result instanceof Blob) { return result; } else if (result instanceof BlobList) { return blobs((BlobList) result); } else if (result instanceof DocumentRef) { CoreSession session = SessionFactory.getSession(request); return Response.status(httpStatus).entity(session.getDocument((DocumentRef) result)).build(); } else if (result instanceof DocumentRefList) { CoreSession session = SessionFactory.getSession(request); return Response.status(httpStatus).entity(((DocumentRefList) result).stream().map(session::getDocument) .collect(Collectors.toCollection(DocumentModelListImpl::new))).build(); } else if (result instanceof List<?> && !((List) result).isEmpty() <START> && ((List) result).get(0) instanceof NuxeoPrincipal) { <END> return result; } else if (result instanceof DocumentModel || result instanceof DocumentModelList || result instanceof JsonAdapter || result instanceof RecordSet || result instanceof Paginable<?>) { return Response.status(httpStatus).entity(result).build(); } else { return Response.status(httpStatus).entity(new DefaultJsonAdapter(result)).build(); } }</code><technical_language>result instanceof List, generics for instanceof. (List<?>) for casts avoid raw type warning (you configure IDE warn those)</technical_language>

Target:
public static Object getResponse(Object result, HttpServletRequest request, int httpStatus) throws IOException, MessagingException { if (result == null || "true".equals(request.getHeader("X-NXVoidOperation"))) { return emptyContent(); } if (result instanceof Blob) { return result; } else if (result instanceof BlobList) { return blobs((BlobList) result); } else if (result instanceof DocumentRef) { CoreSession session = SessionFactory.getSession(request); return Response.status(httpStatus).entity(session.getDocument((DocumentRef) result)).build(); } else if (result instanceof DocumentRefList) { CoreSession session = SessionFactory.getSession(request); return Response.status(httpStatus).entity(((DocumentRefList) result).stream().map(session::getDocument) .collect(Collectors.toCollection(DocumentModelListImpl::new))).build(); } else if (result instanceof List && !((List<?>) result).isEmpty() && ((List<?>) result).get(0) instanceof NuxeoPrincipal) { return Response.status(httpStatus) .entity(new GenericEntity<>(result, TypeUtils.parameterize(List.class, NuxeoPrincipal.class))) .build(); } else if (result instanceof DocumentModel || result instanceof DocumentModelList || result instanceof JsonAdapter || result instanceof RecordSet || result instanceof Paginable<?>) { return Response.status(httpStatus).entity(result).build(); } else { return Response.status(httpStatus).entity(new DefaultJsonAdapter(result)).build(); } }
Source:
<code>public static Set<String> readNodeList(String confDir, String fileName) { List<String> lines; try { lines = Files.readAllLines(Paths.get(confDir, fileName), StandardCharsets.UTF_8); } catch (IOException e) { System.err.format("Failed to read file %s/%s. Ignored.", confDir, fileName); return new HashSet<>(); } Set<String> nodes = new HashSet<>(); <START> for (String line : lines) { <END> String node = line.trim(); if (node.startsWith("#") || node.length() == 0) { continue; } nodes.add(node); } return nodes; }</code><technical_language>I understand logic for this. if lines same? matter? throw error warn user</technical_language>

Target:
public static Set<String> readNodeList(String confDir, String fileName) { List<String> lines; String path = Paths.get(confDir, fileName).normalize().toString(); try { lines = Files.readAllLines(Paths.get(confDir, fileName), StandardCharsets.UTF_8); } catch (IOException e) { System.err.format("Failed to read file %s/%s. Ignored.%n", confDir, fileName); return new HashSet<>(); } Set<String> nodes = new HashSet<>(); for (String line : lines) { String node = line.trim(); if (node.startsWith("#") || node.length() == 0) { continue; } if (!nodes.add(node)) { System.out.format("Duplicate node hostname %s found in %s%n", node, path); } } return nodes; }
Source:
<code><START> private boolean isAdditionalSoftwareChanged(CertificationResult existingCert, CertificationResult updatedCert) { if (certResultRules.hasCertOption(updatedCert.getNumber(), CertificationResultRules.ADDITIONAL_SOFTWARE)) { for (CertificationResultAdditionalSoftware updatedAdditionalSoftware : updatedCert.getAdditionalSoftware()) { boolean hasMatch = false; for (CertificationResultAdditionalSoftware existingAdditionalSoftware : existingCert.getAdditionalSoftware()) { if (updatedAdditionalSoftware.matches(existingAdditionalSoftware)) { hasMatch = true; } } if (!hasMatch) { return true; } } for (CertificationResultAdditionalSoftware existingAdditionalSoftware : existingCert.getAdditionalSoftware()) { boolean hasMatch = false; for (CertificationResultAdditionalSoftware updatedAdditionalSoftware : updatedCert.getAdditionalSoftware()) { if (existingAdditionalSoftware.matches(updatedAdditionalSoftware)) { hasMatch = true; } } if (!hasMatch) { return true; } } } return false; } <END></code><technical_language>I in methods this, if some of Java 8 stream methods, greatly improve readability of code. I Stream.findAny Optional<T> type work here</technical_language>

Target:
private boolean isAdditionalSoftwareChanged(CertificationResult existingCert, CertificationResult updatedCert) { if (certResultRules.hasCertOption(updatedCert.getNumber(), CertificationResultRules.ADDITIONAL_SOFTWARE)) { for (CertificationResultAdditionalSoftware updatedAdditionalSoftware : updatedCert.getAdditionalSoftware()) { boolean isInExistingCert = existingCert.getAdditionalSoftware().stream() .anyMatch(existingAdditionalSoftware -> existingAdditionalSoftware.matches(updatedAdditionalSoftware)); if (!isInExistingCert) { return true; } } for (CertificationResultAdditionalSoftware existingAdditionalSoftware : existingCert.getAdditionalSoftware()) { boolean isInUpdatedCert = updatedCert.getAdditionalSoftware().stream() .anyMatch(updatedAdditionalSoftware -> updatedAdditionalSoftware.matches(existingAdditionalSoftware)); if (!isInUpdatedCert) { return true; } } } return false; }
Source:
<code><START> protected TableName createNewTable(Admin admin) throws IOException { <END> TableName tableName = newTestTableName(); admin.createTable( new HTableDescriptor(tableName).addFamily(new HColumnDescriptor(COLUMN_FAMILY))); return tableName; }</code><technical_language>this static</technical_language>

Target:
private static TableName createNewTable(Admin admin) throws IOException { TableName tableName = newTestTableName(); admin.createTable( new HTableDescriptor(tableName).addFamily(new HColumnDescriptor(COLUMN_FAMILY))); return tableName; }
Source:
<code>public void testMaskResourceClassLoader() throws Exception { PluginWrapper pw = jenkins.getPluginManager().getPlugin("foo1"); Class<?> clazz = pw.classLoader.loadClass("org.apache.http.impl.io.SocketInputBuffer"); ClassLoader cl = clazz.getClassLoader(); URL url = cl.getResource("org/apache/http/impl/io/SocketInputBuffer.class"); <START> assert url != null; <END> assertTrue("expected to find the class from foo1 plugin", url.toString().contains("plugins/foo1")); }</code><technical_language>Minor: JUnit assertions</technical_language>

Target:
public void testMaskResourceClassLoader() throws Exception { PluginWrapper pw = jenkins.getPluginManager().getPlugin("foo1"); Class<?> clazz = pw.classLoader.loadClass("org.apache.http.impl.io.SocketInputBuffer"); ClassLoader cl = clazz.getClassLoader(); URL url = cl.getResource("org/apache/http/impl/io/SocketInputBuffer.class"); assertNotNull(url); assertTrue("expected to find the class from foo1 plugin", url.toString().contains("plugins/foo1")); }
Source:
<code>public void afterRun() { if (recordStore != null) { <START> if (!wanOriginated) { <END> publishWanUpdate(key, cacheRecord); } } }</code><technical_language>Minor: collapse if blocks, in CacheRemoveBackupOperation</technical_language>

Target:
public void afterRun() { if (recordStore != null && !wanOriginated) { publishWanUpdate(key, cacheRecord); } }
Source:
<code>public void run() { synchronized (entitiesToStopOnShutdown) { log.info("Brooklyn stopOnShutdown shutdown-hook invoked: stopping entities: "+entitiesToStopOnShutdown); List<Task> stops = new ArrayList<Task>(); for (Entity entity: entitiesToStopOnShutdown) { try { <START> stops.add(entity.invoke(Startable.STOP, new MutableMap())); <END> } catch (RuntimeException exc) { if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+entity+" returned error (continuing): "+exc, exc); } } try { for (Task t: stops) { try { Object result = t.get(); if (log.isDebugEnabled()) log.debug("stopOnShutdown of completed: {}", t, result); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+t+" returned error (continuing): "+e, e); Exceptions.propagateIfFatal(e); } } } catch (RuntimeInterruptedException e) { Thread.currentThread().interrupt(); if (log.isDebugEnabled()) log.debug("stopOnShutdown interrupted while waiting for entity-stop tasks; continuing: "+e); } } synchronized (managementContextsToTermianteOnShutdown) { log.info("Brooklyn terminateOnShutdown shutdown-hook invoked: terminating management contexts: "+managementContextsToTermianteOnShutdown); for (ManagementContextInternal managementContext: managementContextsToTermianteOnShutdown) { try { managementContext.terminate(); } catch (RuntimeException e) { log.info("terminateOnShutdown of "+managementContext+" returned error (continuing): "+e, e); } } } }</code><technical_language>check effector exists filtering list Predicates.instanceOf(Startable.class)</technical_language>

Target:
public void run() { synchronized (mutex) { log.info("Brooklyn stopOnShutdown shutdown-hook invoked: stopping entities: "+entitiesToStopOnShutdown); List<Task> stops = new ArrayList<Task>(); for (Entity entity: entitiesToStopOnShutdown) { try { stops.add(entity.invoke(Startable.STOP, new MutableMap())); } catch (RuntimeException exc) { if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+entity+" returned error (continuing): "+exc, exc); } } long endTime = System.currentTimeMillis() + shutdownTimeout.toMilliseconds(); for (Task t: stops) { Duration remainingTime = Duration.max(Duration.untilUtc(endTime), Duration.ONE_MILLISECOND); try { Object result = t.getUnchecked(remainingTime); if (log.isDebugEnabled()) log.debug("stopOnShutdown of completed: {}", t, result); } catch (RuntimeInterruptedException e) { Thread.currentThread().interrupt(); endTime = System.currentTimeMillis(); if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+t+" interrupted; (continuing with immediate timeout): "+e); } catch (RuntimeException e) { if (log.isDebugEnabled()) log.debug("stopOnShutdown of "+t+" returned error (continuing): "+e, e); Exceptions.propagateIfFatal(e); } } log.info("Brooklyn terminateOnShutdown shutdown-hook invoked: terminating management contexts: "+managementContextsToTerminateOnShutdown); for (ManagementContextInternal managementContext: managementContextsToTerminateOnShutdown) { try { managementContext.terminate(); } catch (RuntimeException e) { log.info("terminateOnShutdown of "+managementContext+" returned error (continuing): "+e, e); } } } }
Source:
<code>public QualifiedName getQualifiedName() { if (qualifiedName != null) { return qualifiedName; } if (isNested()) { ASTClassOrInterfaceDeclaration parent = this.getFirstParentOfType(ASTClassOrInterfaceDeclaration.class); QualifiedName parentQN = parent.getQualifiedName(); <START> return QualifiedName.makeClassOf(parentQN, this.getImage()); <END> } QualifiedName qname = new QualifiedName(); ASTPackageDeclaration pkg = this.getFirstParentOfType(ASTCompilationUnit.class) .getFirstChildOfType(ASTPackageDeclaration.class); if (pkg != null) { qname.setPackages(pkg.getPackageNameImage().split("\\.")); } qname.setClass(this.getImage()); qualifiedName = qname; return qualifiedName; }</code><technical_language>cache qualifiedName in this.qualifiedName here, too? For other case (not isNested()), cache it. AST change, I think, safe cache way</technical_language>

Target:
public QualifiedName getQualifiedName() { if (qualifiedName == null) { if (isNested()) { ASTClassOrInterfaceDeclaration parent = this.getFirstParentOfType(ASTClassOrInterfaceDeclaration.class); QualifiedName parentQN = parent.getQualifiedName(); qualifiedName = QualifiedName.makeNestedClassOf(parentQN, this.getImage()); return qualifiedName; } qualifiedName = QualifiedName.makeOuterClassOf(this); } return qualifiedName; }
Source:
<code>private void downloadTemplateFile() { String zipFileUrl = baseUrlForTemplates; zipFileUrl += createLandscapeProject ? templateData.getLandscape() : templateData.getPortrait(); <START> DownloadTemplateTask downloadTemplateTask = new DownloadTemplateTask(getActivity(), templateData, zipFileUrl); <END> downloadTemplateTask.setOnDownloadTemplateCompleteListener(this); downloadTemplateTask.execute(); }</code><technical_language>is a getActivity()? put activity a member</technical_language>

Target:
private void downloadTemplateFile() { String zipFileUrl = baseUrlForTemplates; zipFileUrl += createLandscapeProject ? templateData.getLandscape() : templateData.getPortrait(); DownloadTemplateTask downloadTask = new DownloadTemplateTask(getActivity(), templateData, zipFileUrl, this); downloadTask.execute(); }
Source:
<code>static final List<Operator> getOperatorList(StreamsConnection sc, String operatorsList) { List<Operator> opList; OperatorArray opArray; try { opArray = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().fromJson(operatorsList, OperatorArray.class); opList = opArray.operators; for (Operator op : opList) { op.setConnection(sc); } } catch (IllegalStateException e) { <START> opList = new ArrayList<Operator>(); <END> } return opList; }</code><technical_language>is empty list returned IllegalStateException, exception thrown? If empty list is needed, Collections.emptyList() typically used</technical_language>

Target:
static final List<Operator> getOperatorList(StreamsConnection sc, String operatorsList) { List<Operator> opList; OperatorArray opArray; try { opArray = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().fromJson(operatorsList, OperatorArray.class); opList = opArray.operators; for (Operator op : opList) { op.setConnection(sc); } } catch (JsonSyntaxException e) { opList = Collections.<Operator> emptyList(); } return opList; }
Source:
<code>void testLocalInstanceMethod() { compilationHelper .addSourceLines( "Test.java", "import " + Optional.class.getName() + ';', "class Test {", " public Optional<Integer> foo(Optional<String> optional) {", " " return optional.map(v -> bar(v));", " }", " private Integer bar(String value) {", " return value.length();", " }", "}") <START> .doTest(); <END> }</code><technical_language>negative tests necessary refactoring tests well</technical_language>

Target:
void testLocalInstanceMethod() { compile() .addSourceLines( "Test.java", "import " + Optional.class.getName() + ';', "class Test {", " public Optional<Integer> foo(Optional<String> optional) {", " " return optional.map(v -> bar(v));", " }", " private Integer bar(String value) {", " return value.length();", " }", "}") .doTest(); }
Source:
<code>public void sourceRestartedWithDynamicConfig() throws Exception { Long gatheredMoney = HeisenbergSource.gatheredMoney; startFlow("source"); <START> Thread.sleep(TIME_WAIT_MILLIS); <END> assertThat(HeisenbergSource.gatheredMoney, greaterThan(gatheredMoney)); stopFlow("source"); gatheredMoney = HeisenbergSource.gatheredMoney; Thread.sleep(TIME_WAIT_MILLIS); assertThat(gatheredMoney, is(HeisenbergSource.gatheredMoney)); startFlow("source"); Thread.sleep(TIME_WAIT_MILLIS); assertThat(HeisenbergSource.gatheredMoney, greaterThan(gatheredMoney)); }</code><technical_language>do this a sleep. Do this a PollingProber</technical_language>

Target:
public void sourceRestartedWithDynamicConfig() throws Exception { final Long gatheredMoney = HeisenbergSource.gatheredMoney; startFlow("source"); check(TIMEOUT_MILLIS, POLL_DELAY_MILLIS, () -> { assertThat(HeisenbergSource.gatheredMoney, greaterThan(gatheredMoney)); return true; }); stopFlow("source"); final Long gatheredMoneyAfterStop = HeisenbergSource.gatheredMoney; checkNot(TIME_WAIT_MILLIS, POLL_DELAY_MILLIS, () -> { assertThat(HeisenbergSource.gatheredMoney, greaterThan(gatheredMoneyAfterStop)); return true; }); startFlow("source"); check(TIMEOUT_MILLIS, POLL_DELAY_MILLIS, () -> { assertThat(HeisenbergSource.gatheredMoney, greaterThan(gatheredMoneyAfterStop)); return true; }); }
Source:
<code>public void update(final Sensor sensor, final List<Sample> values) { switch (sensor) { case LIGHT: this.light.clear(); this.light.addAll(values); break; case SOUND: <START> this.light.clear(); <END> this.sound.addAll(values); break; case HUMIDITY: this.light.clear(); this.humidity.addAll(values); break; case TEMPERATURE: this.light.clear(); this.temperature.addAll(values); break; case PARTICULATES: this.light.clear(); this.particulates.addAll(values); break; case WAVE_COUNT: this.light.clear(); this.waveCounts.addAll(values); break; case HOLD_COUNT: this.light.clear(); this.holdCounts.addAll(values); break; case SOUND_NUM_DISTURBANCES: this.light.clear(); this.soundNumDisturbances.addAll(values); break; case SOUND_PEAK_DISTURBANCE: this.light.clear(); this.soundPeakDisturbance.addAll(values); break; default: break; } }</code><technical_language>typo</technical_language>

Target:
public void update(final Sensor sensor, final List<Sample> values) { switch (sensor) { case LIGHT: this.light.clear(); this.light.addAll(values); break; case SOUND: this.sound.clear(); this.sound.addAll(values); break; case HUMIDITY: this.humidity.clear(); this.humidity.addAll(values); break; case TEMPERATURE: this.temperature.clear(); this.temperature.addAll(values); break; case PARTICULATES: this.particulates.clear(); this.particulates.addAll(values); break; case WAVE_COUNT: this.waveCounts.clear(); this.waveCounts.addAll(values); break; case HOLD_COUNT: this.holdCounts.clear(); this.holdCounts.addAll(values); break; case SOUND_NUM_DISTURBANCES: this.soundNumDisturbances.clear(); this.soundNumDisturbances.addAll(values); break; case SOUND_PEAK_DISTURBANCE: this.soundPeakDisturbance.clear(); this.soundPeakDisturbance.addAll(values); break; default: break; } }
Source:
<code>protected void executeCommand() { final VDS vds = getVds(); try (EngineLock monitoringLock = acquireMonitorLock()) { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintenanceVds, false); setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Network> networks = getNetworkDao().getAllForCluster(vds.getVdsGroupId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getVdsGroupId(), net); } return null; } }); if (vds.getHighlyAvailableIsConfigured()) { SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, false); if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded()) { haMaintenanceFailed = true; } } } } logMonitorLockReleased("Activate"); <START> if (vds.getVdsGroupSupportsGlusterService()) { <END> runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart")); } }</code><technical_language>reconsider this flow i concerns a great deal of 'restart glusterd' actions hosts, if is harmless - wrong introduce noise host. suggest move this this point VdsEventListener.vdsUpEvent()</technical_language>

Target:
protected void executeCommand() { final VDS vds = getVds(); try (EngineLock monitoringLock = acquireMonitorLock()) { ExecutionHandler.updateSpecificActionJobCompleted(vds.getId(), VdcActionType.MaintenanceVds, false); setSucceeded(setVdsStatus(VDSStatus.Unassigned).getSucceeded()); if (getSucceeded()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Network> networks = getNetworkDao().getAllForCluster(vds.getVdsGroupId()); for (Network net : networks) { NetworkClusterHelper.setStatus(vds.getVdsGroupId(), net); } return null; } }); if (vds.getHighlyAvailableIsConfigured()) { SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, false); if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded()) { haMaintenanceFailed = true; } } } } logMonitorLockReleased("Activate"); }
Source:
<code>protected void loadServerTemplates() { serverTemplateMap.clear(); widgetView.removeAllServerTemplates(); view.removeAllServerTemplates(); specManagementService.call((ServerTemplateList serverTemplates) -> { FluentIterable.from(serverTemplates.getServerTemplates()) .filter(s -> s.getServerInstanceKeys() != null && !s.getServerInstanceKeys().isEmpty()) .forEach(s -> serverTemplateMap.put(s.getId(), s)); final List<String> ids = serverTemplateMap.keySet().stream().sorted(String.CASE_INSENSITIVE_ORDER).collect(Collectors.toList()); for (String id : ids) { widgetView.addServerTemplate(id); view.addServerTemplate(id); } if (ids.size() == 1) { widgetView.selectServerTemplate(ids.iterator().next()); view.selectServerTemplate(ids.iterator().next()); } else { final ServerTemplate selectedServerTemplate = getSelectedServerTemplate(); if (selectedServerTemplate != null && ids.contains(selectedServerTemplate.getId())) { widgetView.selectServerTemplate(selectedServerTemplate.getId()); view.selectServerTemplate(selectedServerTemplate.getId()); } else { widgetView.clearSelectedServerTemplate(); view.clearSelectedServerTemplate(); <START> if(ids.size() > 1) { <END> String defaultServerTemple = ids.get(0); widgetView.selectServerTemplate(defaultServerTemple); view.selectServerTemplate(defaultServerTemple); } } } widgetView.setVisible(ids.size() > 1); view.setVisible(ids.size() > 1); }).listServerTemplates(); }</code><technical_language>@bxf12315 missing space if</technical_language>

Target:
protected void loadServerTemplates() { serverTemplateMap.clear(); widgetView.removeAllServerTemplates(); view.removeAllServerTemplates(); specManagementService.call((ServerTemplateList serverTemplates) -> { FluentIterable.from(serverTemplates.getServerTemplates()) .filter(s -> s.getServerInstanceKeys() != null && !s.getServerInstanceKeys().isEmpty()) .forEach(s -> serverTemplateMap.put(s.getId(), s)); final List<String> ids = serverTemplateMap.keySet().stream().sorted(String.CASE_INSENSITIVE_ORDER).collect(Collectors.toList()); for (String id : ids) { widgetView.addServerTemplate(id); view.addServerTemplate(id); } if (ids.size() == 1) { widgetView.selectServerTemplate(ids.iterator().next()); view.selectServerTemplate(ids.iterator().next()); } else { final ServerTemplate selectedServerTemplate = getSelectedServerTemplate(); if (selectedServerTemplate != null && ids.contains(selectedServerTemplate.getId())) { widgetView.selectServerTemplate(selectedServerTemplate.getId()); view.selectServerTemplate(selectedServerTemplate.getId()); } else { widgetView.clearSelectedServerTemplate(); view.clearSelectedServerTemplate(); if (ids.size() > 1) { String defaultServerTemplate = ids.get(0); widgetView.selectServerTemplate(defaultServerTemplate); view.selectServerTemplate(defaultServerTemplate); } } } widgetView.setVisible(ids.size() > 1); view.setVisible(ids.size() > 1); }).listServerTemplates(); }
Source:
<code>protected void verifyResults(Response response, Map<String, Boolean> results) { for (Map.Entry entry : response.getStringHeaders().entrySet()) { LOG.info("<K, V> ->" + entry); try { String item = entry .getValue() .toString() .split("\\[")[1].split(" ")[1]; if (results.keySet() .contains(item)) { results.put(item.replaceAll(" ", ""), true); } } catch (ArrayIndexOutOfBoundsException e) { <START> LOG.info("[BYPASSED] -> " + entry); <END> } } }</code><technical_language>Is this right? test fail</technical_language>

Target:
protected void verifyResults(Response response, Map<String, Boolean> results) { for (Map.Entry entry : response.getStringHeaders().entrySet()) { LOG.info("<K, V> ->" + entry); try { String item = entry .getValue() .toString() .split("\\[")[1].split(" ")[1]; if (results.keySet() .contains(item)) { results.put(item.replaceAll(" ", ""), true); } } catch (ArrayIndexOutOfBoundsException e) { } } }
Source:
<code>public void revoke(Content content) { <START> if (!(content instanceof Item)) { <END> throw new RuntimeException("content " + content.getCanonicalUri() + " not an item, cannot revoke"); } Item item = (Item) content; Set<String> onDemandIds = onDemandHierarchyExpander.expandHierarchy(item).keySet(); for (String onDemandId : onDemandIds) { Task task = createTaskFor(content, Action.DELETE, TVAElementType.ONDEMAND, onDemandId); YouViewResult deleteResult = client.sendDeleteFor(onDemandId); processDeletionResult(task, item, deleteResult); } revocationStore.revoke(content.getCanonicalUri()); }</code><technical_language>Preconditions.checkArgument here</technical_language>

Target:
public void revoke(Content content) { checkArgument(content instanceof Item, "content " + content.getCanonicalUri() + " not an item, cannot revoke"); Item item = (Item) content; Set<String> onDemandIds = onDemandHierarchyExpander.expandHierarchy(item).keySet(); for (String onDemandId : onDemandIds) { Task task = createTaskFor(content, Action.DELETE, TVAElementType.ONDEMAND, onDemandId); YouViewResult deleteResult = client.sendDeleteFor(onDemandId); processDeletionResult(task, item, deleteResult); } revocationStore.revoke(content.getCanonicalUri()); }
Source:
<code><START> public <T> InstanceAndVersion<T> createProxy(Optional<TrustContext> trustContext, String uri, Class<T> type, <END> AuxiliaryRemotingParameters parameters) { ClientConfiguration clientConfiguration = ClientOptions.DEFAULT_RETRYING.create( ImmutableList.of(uri), Optional.empty(), trustContext.orElseThrow(() -> new IllegalStateException("CJR requires a trust context"))); return wrapWithVersion(JaxRsClient.create( type, addAtlasDbRemotingAgent(parameters.userAgent()), HOST_METRICS_REGISTRY, clientConfiguration)); }</code><technical_language>parameters portion i.e. passing in shouldRetry</technical_language>

Target:
public <T> InstanceAndVersion<T> createProxy( Optional<TrustContext> trustContext, String uri, Class<T> type, AuxiliaryRemotingParameters parameters) { ClientOptions relevantOptions = parameters.shouldRetry() ? ClientOptions.DEFAULT_RETRYING : ClientOptions.DEFAULT_NO_RETRYING; ClientConfiguration clientConfiguration = relevantOptions.create( ImmutableList.of(uri), Optional.empty(), trustContext.orElseThrow(() -> new IllegalStateException("CJR requires a trust context"))); return wrapWithVersion(JaxRsClient.create( type, addAtlasDbRemotingAgent(parameters.userAgent()), HOST_METRICS_REGISTRY, clientConfiguration)); }
Source:
<code>public String getDescription() { <START> return "Dropping an Association to generate a ReadLinkAction"; <END> }</code><technical_language>Missing NLS</technical_language>

Target:
public String getDescription() { return Messages.AssociationToReadLinkActionDropStrategy_Description; }
Source:
<code>private void addAndWatchForChanges(Scene scene, URL cssFile, int index) { scene.getStylesheets().add(index, cssFile.toExternalForm()); try { URI cssUri = cssFile.toURI(); if (!cssUri.toString().contains("jrt")) { LOGGER.debug("CSS URI {}", cssUri); Path cssPath = Paths.get(cssUri).toAbsolutePath(); LOGGER.info("Enabling live reloading of {}", cssPath); fileUpdateMonitor.addListenerForFile(cssPath, () -> { <START> LOGGER.info("Reload css file " + cssFile); <END> DefaultTaskExecutor.runInJavaFXThread(() -> { scene.getStylesheets().remove(cssFile.toExternalForm()); scene.getStylesheets().add(index, cssFile.toExternalForm()); }); }); } } catch (IOException | URISyntaxException | UnsupportedOperationException e) { LOGGER.error("Could not watch css file for changes " + cssFile, e); } }</code><technical_language>LOGGER.info("Reload css file {}", cssFile);</technical_language>

Target:
private void addAndWatchForChanges(Scene scene, URL cssFile, int index) { scene.getStylesheets().add(index, cssFile.toExternalForm()); try { URI cssUri = cssFile.toURI(); if (!cssUri.toString().contains("jrt")) { LOGGER.debug("CSS URI {}", cssUri); Path cssPath = Paths.get(cssUri).toAbsolutePath(); LOGGER.info("Enabling live reloading of {}", cssPath); fileUpdateMonitor.addListenerForFile(cssPath, () -> { LOGGER.info("Reload css file {}", cssFile); DefaultTaskExecutor.runInJavaFXThread(() -> { scene.getStylesheets().remove(cssFile.toExternalForm()); scene.getStylesheets().add(index, cssFile.toExternalForm()); }); }); } } catch (IOException | URISyntaxException | UnsupportedOperationException e) { LOGGER.error("Could not watch css file for changes " + cssFile, e); } }
Source:
<code><START> public String getMappedAttributeOfGroupClaimURL(String ClaimURL, RealmConfiguration realmConfiguration) { <END> switch (ClaimURL) { case UserCoreClaimConstants.GROUP_ID_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupIDAttribute); case UserCoreClaimConstants.GROUP_CREATED_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupCreatedDateAttribute); case UserCoreClaimConstants.GROUP_MODIFIED_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.groupModifiedDateAttribute); default: return null; } }</code><technical_language>add a method description(java-doc) here</technical_language>

Target:
public static String getMappedAttributeOfGroupClaimURL(String ClaimURL, RealmConfiguration realmConfiguration) { switch (ClaimURL) { case UserCoreClaimConstants.GROUP_ID_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_ID_ATTRIBUTE); case UserCoreClaimConstants.GROUP_CREATED_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_CREATED_DATE_ATTRIBUTE); case UserCoreClaimConstants.GROUP_MODIFIED_CLAIM_URI: return realmConfiguration.getUserStoreProperty(UserStoreConfigConstants.GROUP_MODIFIED_DATE_ATTRIBUTE); default: return null; } }
Source:
<code>public NodeProperty getNodeProperty(String className) { <START> for (NodeProperty p: getNodeProperties()) { <END> if (p.getClass().getName().equals(className)) return p; } return null; }</code><technical_language>Formatting: 4-space tabulation in files</technical_language>

Target:
public NodeProperty getNodeProperty(String className) { for (NodeProperty p: getNodeProperties()) { if (p.getClass().getName().equals(className)) { return p; } } return null; }
Source:
<code>public void testRouterBasic() throws Exception { Properties props = getNonBlockingRouterProperties(); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); MockClusterMap mockClusterMap = new MockClusterMap(); MockTime mockTime = new MockTime(); router = new NonBlockingRouter(new RouterConfig(verifiableProperties), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(verifiableProperties, null, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, new MockServerLayout(mockClusterMap), mockTime), new LoggingNotificationSystem(), mockClusterMap, mockTime); assertExpectedThreadCounts(1); setOperationParams(); router.putBlob(putBlobProperties, putUserMetadata, putChannel).get(); router.close(); assertExpectedThreadCounts(0); <START> Future<String> future = router.putBlob(putBlobProperties, putUserMetadata, putChannel); <END> Assert.assertTrue(future.isDone()); RouterException e = (RouterException) ((FutureResult<String>) future).error(); Assert.assertEquals(e.getErrorCode(), RouterErrorCode.RouterClosed); }</code><technical_language>A private method for lines 105 108</technical_language>

Target:
public void testRouterBasic() throws Exception { Properties props = getNonBlockingRouterProperties(); VerifiableProperties verifiableProperties = new VerifiableProperties((props)); MockClusterMap mockClusterMap = new MockClusterMap(); MockTime mockTime = new MockTime(); router = new NonBlockingRouter(new RouterConfig(verifiableProperties), new NonBlockingRouterMetrics(new MetricRegistry()), new MockNetworkClientFactory(verifiableProperties, null, MAX_PORTS_PLAIN_TEXT, MAX_PORTS_SSL, CHECKOUT_TIMEOUT_MS, new MockServerLayout(mockClusterMap), mockTime), new LoggingNotificationSystem(), mockClusterMap, mockTime); assertExpectedThreadCounts(1); setOperationParams(); router.putBlob(putBlobProperties, putUserMetadata, putChannel).get(); router.close(); assertExpectedThreadCounts(0); assertClosed(); }
Source:
<code>protected synchronized void processGetBlockBodies(GetBlockBodiesMessage msg) { Iterator<byte[]> bodiesIterator = blockchain.getIteratorOfBodiesByHashes(msg.getBlockHashes()); List<byte[]> bodies = new ArrayList<>(); <START> int sizeSum = 80; END> while (bodiesIterator.hasNext()) { byte[] body = bodiesIterator.next(); sizeSum += ByteArrayEstimator.estimateSize(body); bodies.add(body); if (sizeSum >= MAX_MESSAGE_SIZE) break; } BlockBodiesMessage response = new BlockBodiesMessage(bodies); sendMessage(response); }</code><technical_language>i) a magic number ii) 80 bytes matter regard 32Kb limit</technical_language>

Target:
protected synchronized void processGetBlockBodies(GetBlockBodiesMessage msg) { Iterator<byte[]> bodiesIterator = blockchain.getIteratorOfBodiesByHashes(msg.getBlockHashes()); List<byte[]> bodies = new ArrayList<>(); int sizeSum = 0; while (bodiesIterator.hasNext()) { byte[] body = bodiesIterator.next(); sizeSum += ByteArrayEstimator.estimateSize(body); bodies.add(body); if (sizeSum >= MAX_MESSAGE_SIZE) break; } BlockBodiesMessage response = new BlockBodiesMessage(bodies); sendMessage(response); }
Source:
<code>public RowsToKeepResult getRowsToKeep(int batchSize, long filePosition) { Optional<BitSet> rowsDeleted = getRowsDeleted(); if (rowsDeleted.isPresent() && rowsDeleted.get().cardinality() > 0) { IntArrayList rowsToKeep = new IntArrayList(batchSize); for (int position = 0; position < batchSize; position++) { if (!rowsDeleted.get().get(toIntExact(filePosition) + position)) { rowsToKeep.add(position); } } if (rowsToKeep.size() == batchSize) { <START> return new RowsToKeepResult(true, new IntArrayList(0)); <END> } return new RowsToKeepResult(false, rowsToKeep); } return new RowsToKeepResult(true, new IntArrayList(0)); }</code><technical_language>a static const put top java private static final RowsToKeepResult KEEP_ALL = new RowsToKeepResult(true, new IntArrayList(0));</technical_language>

Target:
public RowsToKeepResult getRowsToKeep(int batchSize, long filePosition) { Optional<BitSet> rowsDeleted = getRowsDeleted(); if (rowsDeleted.isPresent() && rowsDeleted.get().cardinality() > 0) { IntArrayList rowsToKeep = new IntArrayList(batchSize); for (int position = 0; position < batchSize; position++) { if (!rowsDeleted.get().get(toIntExact(filePosition) + position)) { rowsToKeep.add(position); } } if (rowsToKeep.size() == batchSize) { return KEEP_ALL; } return new RowsToKeepResult(false, rowsToKeep); } return KEEP_ALL; }
Source:
<code>public void insertDiscovery(List<Token> tokens) throws IOException { batchHistogram.update(tokens.size()); if (tokens.size() == 0) return; Timer.Context ctx = writeTimer.time(); try { BulkRequestBuilder bulk = client.prepareBulk(); for (Token token : tokens) { bulk.add(createSingleRequest(token)); } bulk.execute().actionGet(); } catch (EsRejectedExecutionException esEx) { log.error(("Error during bulk insert to ES with status: [" + esEx.status() + "] " + <START> "with message: [" + esEx.getDetailedMessage() + "]")); <END> } finally { ctx.stop(); } }</code><technical_language>want bubble exception</technical_language>

Target:
public void insertDiscovery(List<Token> tokens) throws IOException { batchHistogram.update(tokens.size()); if (tokens.size() == 0) return; Timer.Context ctx = writeTimer.time(); try { BulkRequestBuilder bulk = client.prepareBulk(); for (Token token : tokens) { bulk.add(createSingleRequest(token)); } bulk.execute().actionGet(); } catch (EsRejectedExecutionException esEx) { log.error(("Error during bulk insert to ES with status: [" + esEx.status() + "] " + "with message: [" + esEx.getDetailedMessage() + "]")); throw esEx; } finally { ctx.stop(); } }
Source:
<code>public void setChangeAmount(TemporalAmount changeAmount) { <START> assert changeAmount != null : "changeAmount may not be null"; <END> this.changeAmount = changeAmount; }</code><technical_language>pushed it</technical_language>

Target:
public void setChangeAmount(TemporalAmount changeAmount) { this.changeAmount = Objects.requireNonNull(changeAmount, "changeAmount may not be null"); }
Source:
<code><START> public void setOperatingRate(float operatingRate) { <END> onOperatingRateChanged(operatingRate); }</code><technical_language>final</technical_language>

Target:
public final void setOperatingRate(float operatingRate) { onOperatingRateChanged(operatingRate); }
Source:
<code>public void getPermissions_updatedWithNewRealms_stressTest() { final PermissionManager pm = user.getPermissionManager(); looperThread.closeAfterTest(pm); pm.getPermissions(new PermissionManager.PermissionsCallback() { @Override public void onSuccess(RealmResults<Permission> permissions) { assertTrue(permissions.isLoaded()); assertInitialPermissions(permissions); for (int i = 0; i < 10; i++) { SyncConfiguration configNew = new SyncConfiguration.Builder(user, "realm://127.0.0.1:9080/~/test" + i).build(); Realm newRealm = Realm.getInstance(configNew); looperThread.closeAfterTest(newRealm); } looperThread.keepStrongReference(permissions); permissions.addChangeListener(new RealmChangeListener<RealmResults<Permission>>() { @Override public void onChange(RealmResults<Permission> permissions) { Permission p = permissions.where().endsWith("path", "test9").findFirst(); if (p != null) { assertTrue(p.mayRead()); assertTrue(p.mayWrite()); assertTrue(p.mayManage()); looperThread.testComplete(); } } }); } @Override public void onError(ObjectServerError error) { <START> fail("Could not open Realm: " + error.toString()); <END> } }); }</code><technical_language>Is message correct</technical_language>

Target:
public void getPermissions_updatedWithNewRealms_stressTest() { final PermissionManager pm = user.getPermissionManager(); looperThread.closeAfterTest(pm); pm.getPermissions(new PermissionManager.PermissionsCallback() { @Override public void onSuccess(RealmResults<Permission> permissions) { assertTrue(permissions.isLoaded()); assertInitialPermissions(permissions); for (int i = 0; i < 10; i++) { SyncConfiguration configNew = new SyncConfiguration.Builder(user, "realm://127.0.0.1:9080/~/test" + i).build(); Realm newRealm = Realm.getInstance(configNew); looperThread.closeAfterTest(newRealm); } looperThread.keepStrongReference(permissions); permissions.addChangeListener(new RealmChangeListener<RealmResults<Permission>>() { @Override public void onChange(RealmResults<Permission> permissions) { Permission p = permissions.where().endsWith("path", "test9").findFirst(); if (p != null) { assertTrue(p.mayRead()); assertTrue(p.mayWrite()); assertTrue(p.mayManage()); looperThread.testComplete(); } } }); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); }
Source:
<code>public static void save(Fingerprint fp, File file) throws IOException { if (fp.getPersistedFacets().isEmpty()) { file.getParentFile().mkdirs(); AtomicFileWriter afw = new AtomicFileWriter(file); try { PrintWriter w = new PrintWriter(afw); w.println("<?xml version='1.1' encoding='UTF-8'?>"); w.println("<fingerprint>"); w.print(" <timestamp>"); w.print(DATE_CONVERTER.toString(fp.getTimestamp())); w.println("</timestamp>"); if (fp.getOriginal() != null) { w.println(" <original>"); w.print(" <name>"); w.print(Util.xmlEscape(fp.getOriginal().getName())); w.println("</name>"); w.print(" <number>"); w.print(fp.getOriginal().getNumber()); w.println("</number>"); w.println(" </original>"); } <START> w.print(" <md5sum>"); <END> w.print(fp.getHashString()); w.println("</md5sum>"); w.print(" <fileName>"); w.print(Util.xmlEscape(fp.getFileName())); w.println("</fileName>"); w.println(" <usages>"); for (Map.Entry<String, Fingerprint.RangeSet> e : fp.getUsages().entrySet()) { w.println(" <entry>"); w.print(" <string>"); w.print(Util.xmlEscape(e.getKey())); w.println("</string>"); w.print(" <ranges>"); w.print(Fingerprint.RangeSet.ConverterImpl.serialize(e.getValue())); w.println("</ranges>"); w.println(" </entry>"); } w.println(" </usages>"); w.println(" <facets/>"); w.print("</fingerprint>"); w.flush(); afw.commit(); } finally { afw.abort(); } } else { getConfigFile(file).write(fp); } }</code><technical_language>This tag a source of confusion if fingerprint size is expanded. Anyway, worry get there. suggestion // TODO(oleg_nenashev): Consider renaming field: <LINK_0> w.print(" <md5sum>");</technical_language>

Target:
public static void save(Fingerprint fp, File file) throws IOException { if (fp.getPersistedFacets().isEmpty()) { file.getParentFile().mkdirs(); AtomicFileWriter afw = new AtomicFileWriter(file); try { PrintWriter w = new PrintWriter(afw); w.println("<?xml version='1.1' encoding='UTF-8'?>"); w.println("<fingerprint>"); w.print(" <timestamp>"); w.print(DATE_CONVERTER.toString(fp.getTimestamp())); w.println("</timestamp>"); if (fp.getOriginal() != null) { w.println(" <original>"); w.print(" <name>"); w.print(Util.xmlEscape(fp.getOriginal().getName())); w.println("</name>"); w.print(" <number>"); w.print(fp.getOriginal().getNumber()); w.println("</number>"); w.println(" </original>"); } w.print(" <md5sum>"); w.print(fp.getHashString()); w.println("</md5sum>"); w.print(" <fileName>"); w.print(Util.xmlEscape(fp.getFileName())); w.println("</fileName>"); w.println(" <usages>"); for (Map.Entry<String, Fingerprint.RangeSet> e : fp.getUsages().entrySet()) { w.println(" <entry>"); w.print(" <string>"); w.print(Util.xmlEscape(e.getKey())); w.println("</string>"); w.print(" <ranges>"); w.print(serialize(e.getValue())); w.println("</ranges>"); w.println(" </entry>"); } w.println(" </usages>"); w.println(" <facets/>"); w.print("</fingerprint>"); w.flush(); afw.commit(); } finally { afw.abort(); } } else { getConfigFile(file).write(fp); } }